Neurosis Engine
io_pak.h
Go to the documentation of this file.
00001 
00002 // Neurosis Engine - LP23.com
00003 // Copyright © Luigi Pino. All rights reserved.
00004 
00005 /***************************************************************************/
00006 
00007 #ifndef _NEUROSIS_ENGINE_IO_PAK_H_
00008 #define _NEUROSIS_ENGINE_IO_PAK_H_
00009 
00010 /***************************************************************************/
00011 
00012 //------------------------------------------------
00013 #define CYPHER_VALUE              23
00014 //------------------------------------------------
00015 
00016 /***************************************************************************/
00017 
00018 class CNeurosisPakFile
00019 {
00020   public:
00021     CNeurosisPakFile();
00023     ~CNeurosisPakFile();
00024 
00026     bool  Clear();
00028     bool  Create(char *inputFolder, char *outputFile, bool checkModifiedDate = false);
00030     bool  Load(char *filename);
00032     bool  Extract();
00034     bool  Extract_File(char *filename);
00035 
00036   private:
00037     struct SPakHeader {
00038       char    mSignature[8];                          // Signature (LP23.COM)
00039       float   mVersion;                               // Version number (1.0)
00040       DWORD   mFileEntries;                           // Number of file table entries
00041       char    mID[10];                                // ID (Random)
00042     };
00043 
00044     struct SFileTableEntry {
00045       char            mFilename[30];                  // Name of one file in the PAK
00046       DWORD           mFileSize;                      // The size of the file in bytes
00047       DWORD           mFileOffset;                    // Offset of file in the PAK
00048       SFileTableEntry *pNext;                         // Next file table entry (is a linked list)
00049     };
00050 
00051     bool  Generate();                                 // Create header and file table
00052     bool  WorkOutOffsets();                           // Work out the file offsets in the PAK
00053 
00054     SFileTableEntry *pFileTable;                      // The master file table for the PAK
00055     CString         mFolderPath;                      // Location of folder to compile
00056     CString         mPakName;                         // Location to save PAK
00057     SPakHeader      mHeader;                          // The header of the PAK file
00058 };
00059 
00060 /***************************************************************************/
00061 #endif